package cn.iocoder.yudao.module.infra.controller.admin.face.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * 人脸搜索响应 VO
 *
 * @author 芋道源码
 */
@Schema(description = "管理后台 - 人脸搜索响应 VO")
@Data
public class FaceSearchRespVO {

    @Schema(description = "搜索是否成功", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
    private Boolean success;

    @Schema(description = "错误信息", example = "人脸搜索失败")
    private String errorMessage;

    @Schema(description = "错误代码", example = "222207")
    private Integer errorCode;

    @Schema(description = "处理时间（毫秒）", example = "1500")
    private Long processTime;

    @Schema(description = "用户列表")
    private List<FaceSearchUserVO> userList;

    @Schema(description = "原始响应数据")
    private String rawData;

    /**
     * 人脸搜索用户信息 VO
     */
    @Schema(description = "人脸搜索用户信息")
    @Data
    public static class FaceSearchUserVO {

        @Schema(description = "用户ID", example = "user123")
        private String userId;

        @Schema(description = "相似度分数", example = "98.53768920898438")
        private Double score;

        @Schema(description = "人脸Token", example = "bdabba7b6faf5c96353f012cabfe6de6")
        private String faceToken;

        @Schema(description = "组ID", example = "group1")
        private String groupId;
    }

    /**
     * 创建成功响应
     */
    public static FaceSearchRespVO success(List<FaceSearchUserVO> userList) {
        FaceSearchRespVO resp = new FaceSearchRespVO();
        resp.setSuccess(true);
        resp.setUserList(userList);
        return resp;
    }

    /**
     * 创建失败响应
     */
    public static FaceSearchRespVO error(String errorMessage) {
        FaceSearchRespVO resp = new FaceSearchRespVO();
        resp.setSuccess(false);
        resp.setErrorMessage(errorMessage);
        return resp;
    }

    /**
     * 创建失败响应
     */
    public static FaceSearchRespVO error(Integer errorCode, String errorMessage) {
        FaceSearchRespVO resp = new FaceSearchRespVO();
        resp.setSuccess(false);
        resp.setErrorCode(errorCode);
        resp.setErrorMessage(errorMessage);
        return resp;
    }
}